///**
// *    Copyright 2009-2016 the original author or authors.
// *
// *    Licensed under the Apache License, Version 2.0 (the "License");
// *    you may not use this file except in compliance with the License.
// *    You may obtain a copy of the License at
// *
// *       http://www.apache.org/licenses/LICENSE-2.0
// *
// *    Unless required by applicable law or agreed to in writing, software
// *    distributed under the License is distributed on an "AS IS" BASIS,
// *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// *    See the License for the specific language governing permissions and
// *    limitations under the License.
// */
//package imitate.mybatis.code.generation.type;
//
//import java.lang.reflect.ParameterizedType;
//import java.lang.reflect.Type;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
///**
// * References a generic type.
// *
// * @param <T>
// *            the referenced type
// * @since 3.1.0
// * @author Simone Tripodi
// */
//public abstract class TypeReference<T> {
//	/*** 日志 */
//	private Logger logger = LoggerFactory.getLogger(this.getClass());
//	private final Type rawType;
//
//	protected TypeReference() {
//		rawType = getSuperclassTypeParameter(getClass());
//	}
//
//	Type getSuperclassTypeParameter(Class<?> clazz) {
//		logger.debug("(获取父类参数类型)getSuperclassTypeParameter clazz={}",clazz);
//		Type genericSuperclass = clazz.getGenericSuperclass();
//		if (genericSuperclass instanceof Class) {
//			// try to climb up the hierarchy until meet something useful
//			if (TypeReference.class != genericSuperclass) {
//				return getSuperclassTypeParameter(clazz.getSuperclass());
//			}
//
//			throw new TypeException("'" + getClass() + "' extends TypeReference but misses the type parameter. "
//					+ "Remove the extension or add a type parameter to it.");
//		}
//
//		Type rawType = ((ParameterizedType) genericSuperclass).getActualTypeArguments()[0];
//		// TODO remove this when Reflector is fixed to return Types
//		if (rawType instanceof ParameterizedType) {
//			rawType = ((ParameterizedType) rawType).getRawType();
//		}
//
//		return rawType;
//	}
//
//	public final Type getRawType() {
//		return rawType;
//	}
//
//	@Override
//	public String toString() {
//		return rawType.toString();
//	}
//
//}
